{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c2f6934a-2a29-4cec-9fb7-f374b23157d2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "iloveu\n"
     ]
    }
   ],
   "source": [
    "str = \"ilcdofghavkbwjqperstznyxmu\"  # 这是字符串\n",
    "N = len(str)        # 获取字符串的长度\n",
    "result = \"\"         # 初始化一个空字符串用于存放结果\n",
    "\n",
    "# 初始化迭代次数为1\n",
    "iteration = 1\n",
    "\n",
    "# 初始化索引为0\n",
    "index = 0\n",
    "\n",
    "# 循环遍历字符串，直到达到字符串的长度\n",
    "while index < N:\n",
    "    # 将当前字符添加到结果字符串中\n",
    "    result += str[index]\n",
    "    # ↓打印当前字符和步长，以供参考\n",
    "    # print(f\"Character: {str[index]}, Step: {iteration**2}\")\n",
    "    \n",
    "    # 更新索引，步长为当前迭代次数的平方\n",
    "    index = iteration**2\n",
    "    # 增加迭代次数\n",
    "    iteration += 1\n",
    "\n",
    "print(result)  # 打印结果\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
